package com.wzapp.sitposture.eshop.entity;

import com.wzapp.sitposture.common.converter.BigDecimalConverterJson;
import com.wzapp.sitposture.common.converter.DateConverterJson;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by qianglong on 2018/1/27.
 */
@Data
@Entity(name = "user_order_pay")
public class OrderPay implements Serializable {

    private static final long serialVersionUID = -8130026887061391710L;

    @Id
    @GeneratedValue(generator = "uuid_32")
    @GenericGenerator(name = "uuid_32", strategy = "uuid")
    @Column(length = 32)
    private String id;

    /**
     * 订单号
     */
    private String orderCode;
    /**
     * 订单ID
     */
    @Column(length = 32)
    private String orderId;
    /**
     * 第三方支付交易号
     */
    private String payCode;
    /**
     * 买家ID
     */
    private String userId;
    /**
     * 预支付Id
     */
    private String prepayId;
    /**
     * 付款金额，单位：元
     */
    @Convert(converter = BigDecimalConverterJson.class)
    private Double amount;
    /**
     * 付款金额，单位：元
     */
    @Convert(converter = BigDecimalConverterJson.class)
    private Double receiptsAmount;
    /**
     * 拉起支付APP的URL
     */
    private String payUrl;

    /**
     * 状态 : 0待支付 1支付成功 2支付失败
     */
    private Integer status;
    /**
     * 支付方式: 1-支付宝，2-微信
     */
    private Integer payMethod;
    /**
     * 创建时间，毫秒
     */
    @Column(updatable = false)
    @Convert(converter = DateConverterJson.class)
    private Long createTime;
    /**
     * 更新时间，毫秒
     */
    @Convert(converter = DateConverterJson.class)
    private Long updateTime;
}
